#import "layer_dialog.h"

@implementation LayerDialog

- (id)initLayerDialog
{
	if ((self = [super init]))
	{
		handleSprite_ = nil;
	}
	return self;
}

- (bool)touchBegan:(CGPoint) Point
{
	if (nil != handleSprite_)
	{
		[handleSprite_ touchBegan:Point];
		return false;
	}
	else
	{
		return true;
	}
}

- (bool)touchMoved:(CGPoint) Point
{
	if (nil != handleSprite_)
	{
		[handleSprite_ touchMoved:Point];
		return false;
	}
	else
	{
		return true;
	}
}

- (bool)touchEnded:(CGPoint) Point
{
	if (nil != handleSprite_)
	{
		[handleSprite_ touchEnded:Point];
		return false;
	}
	else
	{
		return true;
	}
}

- (void)runDialog:(SpriteDialog *)Dialog
{
	assert(nil == handleSprite_);
	handleSprite_ = Dialog;
	[self addChild:Dialog];
	[Dialog actionOpen];
}

- (void)stopDialog
{
	assert(nil != handleSprite_);
	[self removeChild:handleSprite_ cleanUp:YES];
	handleSprite_ = nil;
}

@end